package cn.hhy.org.service.impl;

import cn.hhy.org.domain.Shop;
import cn.hhy.org.mapper.ShopMapper;
import cn.hhy.org.query.ShopQuery;
import cn.hhy.org.service.IShopService;
import cn.hhy.utils.QueryResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShopServiceImpl implements IShopService {
    @Autowired
    private ShopMapper shopMapper;

    @Override
    public void PatchDelete(Long[] ids) {
        shopMapper.PatchDelete(ids);
    }

    @Override
    public void save(Shop shop) {
        shopMapper.save(shop);
    }

    @Override
    public void update(Shop shop) {
        shopMapper.update(shop);
    }

    @Override
    public void delete(Long id) {
        shopMapper.delete(id);
    }

    @Override
    public Shop loadById(Long id) {
        return shopMapper.loadById(id);
    }

    @Override
    public List<Shop> loadAll() {
        return shopMapper.loadAll();
    }

    @Override
    public QueryResult<Shop> shopLoadAll(ShopQuery shopQuery) {
        Long shopCountByQuery = shopMapper.findShopCountByQuery(shopQuery);
        List<Shop> shopByQuery = shopMapper.shopLoadAll(shopQuery);
        return new QueryResult<Shop>(shopCountByQuery,shopByQuery);
    }


}
